<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class Order extends Model
{
    use HasFactory;

    protected $fillable = [
        'serial_number',
        'user_id',
        "coupon_code",
        "phone",
        "name",
        "province",
        "city",
        "district",
        "street",
        "home",
        "status",
        "date",
        "time",
        "coupon_id",
        "product_id",
        "provider_order_id",
        "provider_order_status",
        "remark"
    ];

    public static function formatStatusCode($statusCode)
    {
        $status = 0;
        switch($statusCode) {
            case 'E0001':
                $status = 1;
            break;
            case 'E0004':
                $status = 4;
            break;
            case 'E0006':
                $status = 6;
            break;
            case 'E0008':
                $status = 8;
            break;
            default:
                $status = 0;
        }
        return $status;
    }
}
